<template>
    <div v-loading="loading">
        <Archive
            v-if="pageType === 'archive'"
            :know="editorRow"
            @listen="handlePages"
        />

        <Lists
            v-if="pageType === 'lists'"
            @listen="handlePages"
        />
    </div>
</template>

<script setup lang="ts">
import Archive from './_components/archive.vue'
import Lists from './_components/lists.vue'

const loading = ref<boolean>(false)
const pageType = ref<string>('lists')
const editorRow = ref<any>({})

/**
 * 处理页面
 *
 * @param {string} type
 * @param {any} row
 * @author zero
 */
const handlePages = (type: string, row?: any) => {
    loading.value = true
    setTimeout(() => {
        editorRow.value = row
        pageType.value = type
        loading.value = false
    }, 600)
}
</script>
